import { developmentUrl } from "../config/env";
import request from "../config/axios";
export const TaskListInterface = (data) => request({
    url: `${developmentUrl}/task/list?name=${data.name}&page=${data.page}`,
    method: "GET",
    data
})

//修改
export const taskEdit = (data) => request({
    url: `${developmentUrl}/task?id=${data.id}&name=${data.name}&jobClass=${data.jobClass}&cron=${data.cron}&data=${data.data}&note=${data.note}`,
    method: "POST",
})

//添加
//http://localhost:9528/dev-api/task?name=123&jobClass=123&cron=123&data=%7B%22hour%22:12%7D&note=123
export const taskAdd = (data) => request({
    url: `${developmentUrl}/task?name=${data.name}&jobClass=${data.jobClass}&cron=${data.cron}&data=${data.data}&note=${data.note}`,
    method: "POST",
})

//删除
export const deleteData = (data) => request({
    url: `${developmentUrl}/task?id=${data.id}`,
    method: "DELETE",
})

//disabled true
//http://localhost:9528/dev-api/task/enable/?taskId=1
export const isDIsabledTrue = (data) => request({
    url: `${developmentUrl}/task/enable/?taskId=${data.taskId}`,
    method: "POST",
})

//disabled false
//http://localhost:9528/dev-api/task/enable/?taskId=1
export const isDIsabledFalse = (data) => request({
    url: `${developmentUrl}/task/disable/?taskId=${data.taskId}`,
    method: "POST",
})

